# ============================================================
# Hagenaars [Sport]Fysio — Apache configuratie
# ============================================================

# Custom 404-pagina
ErrorDocument 404 /404.php

# Verwijder .php uit URLs (optioneel: nettere URLs)
# Uncomment indien gewenst — alle interne links moeten dan zonder .php
# RewriteEngine On
# RewriteCond %{REQUEST_FILENAME} !-d
# RewriteCond %{REQUEST_FILENAME}\.php -f
# RewriteRule ^([^.]+)$ $1.php [NC,L]

RewriteEngine On

# ============================================================
# Forceer HTTPS (cPanel SSL moet aan staan)
# ============================================================
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Forceer www. — uncomment indien gewenst
# RewriteCond %{HTTP_HOST} !^www\. [NC]
# RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# ============================================================
# 301-redirects van OUDE URL's naar NIEUWE pagina's
# (behoudt SEO van bestaande site)
# ============================================================
RewriteRule ^pages/nl/welkom/?$ / [R=301,L]
RewriteRule ^pages/nl/wie/?$ /team.php [R=301,L]
RewriteRule ^pages/nl/wie/team/?$ /team.php [R=301,L]
RewriteRule ^pages/nl/wat/?$ / [R=301,L]
RewriteRule ^pages/nl/wat/.*$ / [R=301,L]
RewriteRule ^pages/nl/werkwijze/?$ /sportfysiotherapie.php [R=301,L]
RewriteRule ^pages/nl/werkwijze/orthopedische_revalidatie/?$ /orthopedische-revalidatie.php [R=301,L]
RewriteRule ^pages/nl/werkwijze/sportfysiotherapie/?$ /sportfysiotherapie.php [R=301,L]
RewriteRule ^pages/nl/werkwijze/dry_needling/?$ /dry-needling.php [R=301,L]
RewriteRule ^pages/nl/topsportbegeleiding/?$ /topsportbegeleiding.php [R=301,L]
RewriteRule ^pages/nl/info/?$ /contact.php [R=301,L]
RewriteRule ^pages/nl/info/contactformulier/?$ /contact.php [R=301,L]
RewriteRule ^pages/nl/info/routebeschrijving/?$ /contact.php [R=301,L]
RewriteRule ^pages/nl/info/vergoedingen/?$ /vergoedingen.php [R=301,L]
RewriteRule ^pages/nl/info/tarieven_2026/?$ /tarieven.php [R=301,L]
RewriteRule ^pages/nl/info/tarieven.*$ /tarieven.php [R=301,L]
RewriteRule ^pages/nl/info/praktijkinformatie/?$ /contact.php [R=301,L]
RewriteRule ^pages/nl/info/media/?$ / [R=301,L]
RewriteRule ^pages/nl/info/privacy_policy/?$ /privacy.php [R=301,L]
RewriteRule ^pages/nl/info/ingeval.*$ / [R=301,L]
RewriteRule ^pages/nl/footer/sitemap/?$ /sitemap.xml [R=301,L]
RewriteRule ^pages/nl/footer/voorwaarden/?$ /voorwaarden.php [R=301,L]

# ============================================================
# Performance: cache statische assets in browser
# ============================================================
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/jpeg "access plus 1 year"
  ExpiresByType image/png "access plus 1 year"
  ExpiresByType image/webp "access plus 1 year"
  ExpiresByType image/svg+xml "access plus 1 year"
  ExpiresByType image/x-icon "access plus 1 year"
  ExpiresByType text/css "access plus 1 month"
  ExpiresByType application/javascript "access plus 1 month"
  ExpiresByType font/woff2 "access plus 1 year"
</IfModule>

# ============================================================
# Compressie van tekst (kleinere downloads)
# ============================================================
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css application/javascript application/json image/svg+xml
</IfModule>

# ============================================================
# Beveiliging: voorkom toegang tot includes/ map en .htaccess
# ============================================================
<FilesMatch "^\.">
  Require all denied
</FilesMatch>

RewriteRule ^includes/.* - [F,L]
